<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Testing</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GTK+ 3 参考手册">
<link rel="up" href="gtkbase.html" title="Part II. GTK+核心参考">
<link rel="prev" href="gtk3-Selections.html" title="Selections">
<link rel="next" href="gtk3-Filesystem-utilities.html" title="Filesystem utilities">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gtk3-Selections.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="gtkbase.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GTK+ 3 参考手册</th>
<td><a accesskey="n" href="gtk3-Filesystem-utilities.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gtk3-Testing.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gtk3-Testing.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gtk3-Testing"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gtk3-Testing.top_of_page"></a>Testing</span></h2>
<p>Testing — Utilities for testing GTK+ applications</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gtk3-Testing.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gtk/gtk.h&gt;

<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-Testing.html#gtk-test-create-simple-window" title="gtk_test_create_simple_window ()">gtk_test_create_simple_window</a>       (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *window_title</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *dialog_text</code></em>);
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-Testing.html#gtk-test-create-widget" title="gtk_test_create_widget ()">gtk_test_create_widget</a>              (<em class="parameter"><code><a href="../gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> widget_type</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *first_property_name</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-Testing.html#gtk-test-display-button-window" title="gtk_test_display_button_window ()">gtk_test_display_button_window</a>      (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *window_title</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *dialog_text</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-Testing.html#gtk-test-find-label" title="gtk_test_find_label ()">gtk_test_find_label</a>                 (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *label_pattern</code></em>);
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-Testing.html#gtk-test-find-sibling" title="gtk_test_find_sibling ()">gtk_test_find_sibling</a>               (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *base_widget</code></em>,
                                                         <em class="parameter"><code><a href="../gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> widget_type</code></em>);
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-Testing.html#gtk-test-find-widget" title="gtk_test_find_widget ()">gtk_test_find_widget</a>                (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *label_pattern</code></em>,
                                                         <em class="parameter"><code><a href="../gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> widget_type</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-Testing.html#gtk-test-init" title="gtk_test_init ()">gtk_test_init</a>                       (<em class="parameter"><code><span class="type">int</span> *argcp</code></em>,
                                                         <em class="parameter"><code><span class="type">char</span> ***argvp</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
const <a href="../gobject/gobject-Type-Information.html#GType"><span class="returnvalue">GType</span></a> *       <a class="link" href="gtk3-Testing.html#gtk-test-list-all-types" title="gtk_test_list_all_types ()">gtk_test_list_all_types</a>             (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *n_types</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-Testing.html#gtk-test-register-all-types" title="gtk_test_register_all_types ()">gtk_test_register_all_types</a>         (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">double</span>              <a class="link" href="gtk3-Testing.html#gtk-test-slider-get-value" title="gtk_test_slider_get_value ()">gtk_test_slider_get_value</a>           (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-Testing.html#gtk-test-slider-set-perc" title="gtk_test_slider_set_perc ()">gtk_test_slider_set_perc</a>            (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> percentage</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gtk3-Testing.html#gtk-test-spin-button-click" title="gtk_test_spin_button_click ()">gtk_test_spin_button_click</a>          (<em class="parameter"><code><a class="link" href="gtk3-GtkSpinButton.html#GtkSpinButton" title="struct GtkSpinButton"><span class="type">GtkSpinButton</span></a> *spinner</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> button</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> upwards</code></em>);
<a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             <a class="link" href="gtk3-Testing.html#gtk-test-text-get" title="gtk_test_text_get ()">gtk_test_text_get</a>                   (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-Testing.html#gtk-test-text-set" title="gtk_test_text_set ()">gtk_test_text_set</a>                   (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *string</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gtk3-Testing.html#gtk-test-widget-click" title="gtk_test_widget_click ()">gtk_test_widget_click</a>               (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> button</code></em>,
                                                         <em class="parameter"><code><a href="../gdk3/gdk3-Windows.html#GdkModifierType"><span class="type">GdkModifierType</span></a> modifiers</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gtk3-Testing.html#gtk-test-widget-send-key" title="gtk_test_widget_send_key ()">gtk_test_widget_send_key</a>            (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> keyval</code></em>,
                                                         <em class="parameter"><code><a href="../gdk3/gdk3-Windows.html#GdkModifierType"><span class="type">GdkModifierType</span></a> modifiers</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gtk3-Testing.description"></a><h2>Description</h2>
</div>
<div class="refsect1">
<a name="gtk3-Testing.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="gtk-test-create-simple-window"></a><h3>gtk_test_create_simple_window ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_test_create_simple_window       (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *window_title</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *dialog_text</code></em>);</pre>
<p>
Create a simple window with window title <em class="parameter"><code>window_title</code></em> and
text contents <em class="parameter"><code>dialog_text</code></em>.
The window will quit any running <a class="link" href="gtk3-General.html#gtk-main" title="gtk_main ()"><code class="function">gtk_main()</code></a>-loop when destroyed, and it
will automatically be destroyed upon test function teardown.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>window_title</code></em> :</span></p></td>
<td>Title of the window to be displayed.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog_text</code></em> :</span></p></td>
<td>Text inside the window to be displayed.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a widget pointer to the newly created GtkWindow. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-create-widget"></a><h3>gtk_test_create_widget ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_test_create_widget              (<em class="parameter"><code><a href="../gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> widget_type</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *first_property_name</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
This function wraps <a href="../gobject/gobject-The-Base-Object-Type.html#g-object-new"><code class="function">g_object_new()</code></a> for widget types.
It'll automatically show all created non window widgets, also
<a href="../gobject/gobject-The-Base-Object-Type.html#g-object-ref-sink"><code class="function">g_object_ref_sink()</code></a> them (to keep them alive across a running test)
and set them up for destruction during the next test teardown phase.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>widget_type</code></em> :</span></p></td>
<td>a valid widget type.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>first_property_name</code></em> :</span></p></td>
<td>Name of first property to set or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a newly created widget. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-display-button-window"></a><h3>gtk_test_display_button_window ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_test_display_button_window      (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *window_title</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *dialog_text</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Create a window with window title <em class="parameter"><code>window_title</code></em>, text contents <em class="parameter"><code>dialog_text</code></em>,
and a number of buttons, according to the paired argument list given
as @... parameters.
Each button is created with a <em class="parameter"><code>label</code></em> and a ::clicked signal handler that
incremrents the integer stored in <em class="parameter"><code>nump</code></em>.
The window will be automatically shown with <a class="link" href="gtk3-GtkWidget.html#gtk-widget-show-now" title="gtk_widget_show_now ()"><code class="function">gtk_widget_show_now()</code></a> after
creation, so when this function returns it has already been mapped,
resized and positioned on screen.
The window will quit any running <a class="link" href="gtk3-General.html#gtk-main" title="gtk_main ()"><code class="function">gtk_main()</code></a>-loop when destroyed, and it
will automatically be destroyed upon test function teardown.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>window_title</code></em> :</span></p></td>
<td>Title of the window to be displayed.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog_text</code></em> :</span></p></td>
<td>Text inside the window to be displayed.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>
<a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> terminated list of (const char *label, int *nump) pairs.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a widget pointer to the newly created GtkWindow. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-find-label"></a><h3>gtk_test_find_label ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_test_find_label                 (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *label_pattern</code></em>);</pre>
<p>
This function will search <em class="parameter"><code>widget</code></em> and all its descendants for a GtkLabel
widget with a text string matching <em class="parameter"><code>label_pattern</code></em>.
The <em class="parameter"><code>label_pattern</code></em> may contain asterisks '*' and question marks '?' as
placeholders, <a href="../glib/glib-Glob-style-pattern-matching.html#g-pattern-match"><code class="function">g_pattern_match()</code></a> is used for the matching.
Note that locales other than "C" tend to alter (translate" label strings,
so this function is genrally only useful in test programs with
predetermined locales, see <a class="link" href="gtk3-Testing.html#gtk-test-init" title="gtk_test_init ()"><code class="function">gtk_test_init()</code></a> for more details.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>widget</code></em> :</span></p></td>
<td>Valid label or container widget.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>label_pattern</code></em> :</span></p></td>
<td>Shell-glob pattern to match a label string.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a GtkLabel widget if any is found. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-find-sibling"></a><h3>gtk_test_find_sibling ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_test_find_sibling               (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *base_widget</code></em>,
                                                         <em class="parameter"><code><a href="../gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> widget_type</code></em>);</pre>
<p>
This function will search siblings of <em class="parameter"><code>base_widget</code></em> and siblings of its
ancestors for all widgets matching <em class="parameter"><code>widget_type</code></em>.
Of the matching widgets, the one that is geometrically closest to
<em class="parameter"><code>base_widget</code></em> will be returned.
The general purpose of this function is to find the most likely "action"
widget, relative to another labeling widget. Such as finding a
button or text entry widget, given its corresponding label widget.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>base_widget</code></em> :</span></p></td>
<td>Valid widget, part of a widget hierarchy</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>widget_type</code></em> :</span></p></td>
<td>Type of a aearched for sibling widget</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a widget of type <em class="parameter"><code>widget_type</code></em> if any is found. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-find-widget"></a><h3>gtk_test_find_widget ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_test_find_widget                (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *label_pattern</code></em>,
                                                         <em class="parameter"><code><a href="../gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> widget_type</code></em>);</pre>
<p>
This function will search the descendants of <em class="parameter"><code>widget</code></em> for a widget
of type <em class="parameter"><code>widget_type</code></em> that has a label matching <em class="parameter"><code>label_pattern</code></em> next
to it. This is most useful for automated GUI testing, e.g. to find
the "OK" button in a dialog and synthesize clicks on it.
However see <a class="link" href="gtk3-Testing.html#gtk-test-find-label" title="gtk_test_find_label ()"><code class="function">gtk_test_find_label()</code></a>, <a class="link" href="gtk3-Testing.html#gtk-test-find-sibling" title="gtk_test_find_sibling ()"><code class="function">gtk_test_find_sibling()</code></a> and
<a class="link" href="gtk3-Testing.html#gtk-test-widget-click" title="gtk_test_widget_click ()"><code class="function">gtk_test_widget_click()</code></a> for possible caveats involving the search of
such widgets and synthesizing widget events.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>widget</code></em> :</span></p></td>
<td>Container widget, usually a GtkWindow.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>label_pattern</code></em> :</span></p></td>
<td>Shell-glob pattern to match a label string.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>widget_type</code></em> :</span></p></td>
<td>Type of a aearched for label sibling widget.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a valid widget if any is found or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-init"></a><h3>gtk_test_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_test_init                       (<em class="parameter"><code><span class="type">int</span> *argcp</code></em>,
                                                         <em class="parameter"><code><span class="type">char</span> ***argvp</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
This function is used to initialize a GTK+ test program.
</p>
<p>
It will in turn call <a href="../glib/glib-Testing.html#g-test-init"><code class="function">g_test_init()</code></a> and <a class="link" href="gtk3-General.html#gtk-init" title="gtk_init ()"><code class="function">gtk_init()</code></a> to properly
initialize the testing framework and graphical toolkit. It'll 
also set the program's locale to "C" and prevent loading of rc 
files and Gtk+ modules. This is done to make tets program
environments as deterministic as possible.
</p>
<p>
Like <a class="link" href="gtk3-General.html#gtk-init" title="gtk_init ()"><code class="function">gtk_init()</code></a> and <a href="../glib/glib-Testing.html#g-test-init"><code class="function">g_test_init()</code></a>, any known arguments will be
processed and stripped from <em class="parameter"><code>argc</code></em> and <em class="parameter"><code>argv</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>argcp</code></em> :</span></p></td>
<td>Address of the <em class="parameter"><code>argc</code></em> parameter of the
<code class="function">main()</code> function. Changed if any arguments were handled.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>argvp</code></em> :</span></p></td>
<td>Address of the
<em class="parameter"><code>argv</code></em> parameter of <code class="function">main()</code>.
Any parameters understood by <a href="../glib/glib-Testing.html#g-test-init"><code class="function">g_test_init()</code></a> or <a class="link" href="gtk3-General.html#gtk-init" title="gtk_init ()"><code class="function">gtk_init()</code></a> are
stripped before return. <span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=argcp]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-list-all-types"></a><h3>gtk_test_list_all_types ()</h3>
<pre class="programlisting">const <a href="../gobject/gobject-Type-Information.html#GType"><span class="returnvalue">GType</span></a> *       gtk_test_list_all_types             (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *n_types</code></em>);</pre>
<p>
Return the type ids that have been registered after
calling <a class="link" href="gtk3-Testing.html#gtk-test-register-all-types" title="gtk_test_register_all_types ()"><code class="function">gtk_test_register_all_types()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_types</code></em> :</span></p></td>
<td>location to store number of types</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0-terminated array of type ids. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_types zero-terminated=1][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-register-all-types"></a><h3>gtk_test_register_all_types ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_test_register_all_types         (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Force registration of all core Gtk+ and Gdk object types.
This allowes to refer to any of those object types via
<a href="../gobject/gobject-Type-Information.html#g-type-from-name"><code class="function">g_type_from_name()</code></a> after calling this function.
</p>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-slider-get-value"></a><h3>gtk_test_slider_get_value ()</h3>
<pre class="programlisting"><span class="returnvalue">double</span>              gtk_test_slider_get_value           (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>);</pre>
<p>
Retrive the literal adjustment value for GtkRange based
widgets and spin buttons. Note that the value returned by
this function is anything between the lower and upper bounds
of the adjustment belonging to <em class="parameter"><code>widget</code></em>, and is not a percentage
as passed in to <a class="link" href="gtk3-Testing.html#gtk-test-slider-set-perc" title="gtk_test_slider_set_perc ()"><code class="function">gtk_test_slider_set_perc()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>widget</code></em> :</span></p></td>
<td>valid widget pointer.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>gtk_adjustment_get_value (adjustment) for an adjustment belonging to <em class="parameter"><code>widget</code></em>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-slider-set-perc"></a><h3>gtk_test_slider_set_perc ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_test_slider_set_perc            (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> percentage</code></em>);</pre>
<p>
This function will adjust the slider position of all GtkRange
based widgets, such as scrollbars or scales, it'll also adjust
spin buttons. The adjustment value of these widgets is set to
a value between the lower and upper limits, according to the
<em class="parameter"><code>percentage</code></em> argument.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>widget</code></em> :</span></p></td>
<td>valid widget pointer.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>percentage</code></em> :</span></p></td>
<td>value between 0 and 100.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-spin-button-click"></a><h3>gtk_test_spin_button_click ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gtk_test_spin_button_click          (<em class="parameter"><code><a class="link" href="gtk3-GtkSpinButton.html#GtkSpinButton" title="struct GtkSpinButton"><span class="type">GtkSpinButton</span></a> *spinner</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> button</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> upwards</code></em>);</pre>
<p>
This function will generate a <em class="parameter"><code>button</code></em> click in the upwards or downwards
spin button arrow areas, usually leading to an increase or decrease of
spin button's value.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>spinner</code></em> :</span></p></td>
<td>valid GtkSpinButton widget.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>button</code></em> :</span></p></td>
<td>Number of the pointer button for the event, usually 1, 2 or 3.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>upwards</code></em> :</span></p></td>
<td>
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for upwards arrow click, <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> for downwards arrow click.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>wether all actions neccessary for the button click simulation were carried out successfully.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-text-get"></a><h3>gtk_test_text_get ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             gtk_test_text_get                   (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>);</pre>
<p>
Retrive the text string of <em class="parameter"><code>widget</code></em> if it is a GtkLabel,
GtkEditable (entry and text widgets) or GtkTextView.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>widget</code></em> :</span></p></td>
<td>valid widget pointer.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>new 0-terminated C string, needs to be released with <a href="../glib/glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-text-set"></a><h3>gtk_test_text_set ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_test_text_set                   (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *string</code></em>);</pre>
<p>
Set the text string of <em class="parameter"><code>widget</code></em> to <em class="parameter"><code>string</code></em> if it is a GtkLabel,
GtkEditable (entry and text widgets) or GtkTextView.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>widget</code></em> :</span></p></td>
<td>valid widget pointer.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td>
<td>a 0-terminated C string</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-widget-click"></a><h3>gtk_test_widget_click ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gtk_test_widget_click               (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> button</code></em>,
                                                         <em class="parameter"><code><a href="../gdk3/gdk3-Windows.html#GdkModifierType"><span class="type">GdkModifierType</span></a> modifiers</code></em>);</pre>
<p>
This function will generate a <em class="parameter"><code>button</code></em> click (button press and button
release event) in the middle of the first GdkWindow found that belongs
to <em class="parameter"><code>widget</code></em>.
For <code class="literal">GTK_NO_WINDOW</code> widgets like GtkButton, this will often be an
input-only event window. For other widgets, this is usually widget-&gt;window.
Certain caveats should be considered when using this function, in
particular because the mouse pointer is warped to the button click
location, see <a href="../gdk3/gdk3-Testing.html#gdk-test-simulate-button"><code class="function">gdk_test_simulate_button()</code></a> for details.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>widget</code></em> :</span></p></td>
<td>Widget to generate a button click on.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>button</code></em> :</span></p></td>
<td>Number of the pointer button for the event, usually 1, 2 or 3.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>modifiers</code></em> :</span></p></td>
<td>Keyboard modifiers the event is setup with.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>wether all actions neccessary for the button click simulation were carried out successfully.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-widget-send-key"></a><h3>gtk_test_widget_send_key ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gtk_test_widget_send_key            (<em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> keyval</code></em>,
                                                         <em class="parameter"><code><a href="../gdk3/gdk3-Windows.html#GdkModifierType"><span class="type">GdkModifierType</span></a> modifiers</code></em>);</pre>
<p>
This function will generate keyboard press and release events in
the middle of the first GdkWindow found that belongs to <em class="parameter"><code>widget</code></em>.
For <code class="literal">GTK_NO_WINDOW</code> widgets like GtkButton, this will often be an
input-only event window. For other widgets, this is usually widget-&gt;window.
Certain caveats should be considered when using this function, in
particular because the mouse pointer is warped to the key press
location, see <a href="../gdk3/gdk3-Testing.html#gdk-test-simulate-key"><code class="function">gdk_test_simulate_key()</code></a> for details.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>widget</code></em> :</span></p></td>
<td>Widget to generate a key press and release on.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>keyval</code></em> :</span></p></td>
<td>A Gdk keyboard value.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>modifiers</code></em> :</span></p></td>
<td>Keyboard modifiers the event is setup with.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>wether all actions neccessary for the key event simulation were carried out successfully.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>